#ifndef CLIENT_HPP
#define CLIENT_HPP

#include <QObject>
#include <QDate>

#include "../server/Commands.hpp"

class QTcpSocket;
class QHostAddress;
class QXmlStreamReader;
class QDate;
class QByteArray;

class Client : public QObject
{
    Q_OBJECT
public:
    explicit Client(QObject *parent = 0);
private:
    void writeXmlMessageSize(QByteArray &data);
    void parseXml(QByteArray &data);
    void parseCommand(QXmlStreamReader &xml);
    void parseAnswerAuthorisation(QXmlStreamReader &xml);
    void parseAnswerAllTransport(QXmlStreamReader &xml);

    QTcpSocket  *m_socket;
    
signals:
    void errorForHumans(QString error);
    void connected();
    void settingsUserRight(quint16);
public slots:
    void connectToHost(QString hostIP, quint16 port);
    void authorization(QString name, QString password);
    void allTransport();
    void searchOnNetxMonth(QDate date);
    void socketConnected();
    void disconnectFromHost();

private slots:
    void readyRead();
};

#endif // CLIENT_HPP
